import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { Car } from '../../car/entities/car.entity';
import { Service } from '../../service/entities/service.entity';
import { User } from '../../user/entities/user.entity';

@Entity('cart')
export class Cart {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    type: 'boolean',
    comment: '是否被删除',
    default: false,
  })
  isDelete: boolean;

  @Column({
    type: 'varchar',
    comment: '类型',
    nullable: false,
    default: 'cart',
  })
  type: string;

  @ManyToOne(() => Car, (car) => car.cart)
  car: Car;

  @ManyToOne(() => User, (user) => user.cart)
  user: User;

  @ManyToOne(() => Service, (ser) => ser.cart)
  service: Service;
}
